package com.vaadin.tutorial.crm.backend.repository;

import com.vaadin.tutorial.crm.backend.entity.Teacher;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface TeacherRepository extends JpaRepository<Teacher, Long> {
    @Query("select tea from Teacher tea " +
            "where tea.teacherNum like concat('%', :searchTerm, '%') " +
            "or tea.teacherName like concat('%', :searchTerm, '%')")
    List<Teacher> search(@Param("searchTerm") String searchTerm);
}
